13 research outputs found

    Finding and Counting Permutations via CSPs

    Get PDF
    Permutation patterns and pattern avoidance have been intensively studied in combinatorics and computer science, going back at least to the seminal work of Knuth on stack-sorting (1968). Perhaps the most natural algorithmic question in this area is deciding whether a given permutation of length n contains a given pattern of length k. In this work we give two new algorithms for this well-studied problem, one whose running time is n^{k/4 + o(k)}, and a polynomial-space algorithm whose running time is the better of O(1.6181^n) and O(n^{k/2 + 1}). These results improve the earlier best bounds of n^{0.47k + o(k)} and O(1.79^n) due to Ahal and Rabinovich (2000) resp. Bruner and Lackner (2012) and are the fastest algorithms for the problem when k in Omega(log{n}). We show that both our new algorithms and the previous exponential-time algorithms in the literature can be viewed through the unifying lens of constraint-satisfaction. Our algorithms can also count, within the same running time, the number of occurrences of a pattern. We show that this result is close to optimal: solving the counting problem in time f(k) * n^{o(k/log{k})} would contradict the exponential-time hypothesis (ETH). For some special classes of patterns we obtain improved running times. We further prove that 3-increasing and 3-decreasing permutations can, in some sense, embed arbitrary permutations of almost linear length, which indicates that an algorithm with sub-exponential running time is unlikely, even for patterns from these restricted classes

    Fast Approximation of Search Trees on Trees with Centroid Trees

    Get PDF

    Optimization with pattern-avoiding input

    Full text link
    Permutation pattern-avoidance is a central concept of both enumerative and extremal combinatorics. In this paper we study the effect of permutation pattern-avoidance on the complexity of optimization problems. In the context of the dynamic optimality conjecture (Sleator, Tarjan, STOC 1983), Chalermsook, Goswami, Kozma, Mehlhorn, and Saranurak (FOCS 2015) conjectured that the amortized access cost of an optimal binary search tree (BST) is O(1)O(1) whenever the access sequence avoids some fixed pattern. They showed a bound of 2α(n)O(1)2^{\alpha{(n)}^{O(1)}}, which was recently improved to 2α(n)(1+o(1))2^{\alpha{(n)}(1+o(1))} by Chalermsook, Pettie, and Yingchareonthawornchai (2023); here nn is the BST size and α()\alpha(\cdot) the inverse-Ackermann function. In this paper we resolve the conjecture, showing a tight O(1)O(1) bound. This indicates a barrier to dynamic optimality: any candidate online BST (e.g., splay trees or greedy trees) must match this optimum, but current analysis techniques only give superconstant bounds. More broadly, we argue that the easiness of pattern-avoiding input is a general phenomenon, not limited to BSTs or even to data structures. To illustrate this, we show that when the input avoids an arbitrary, fixed, a priori unknown pattern, one can efficiently compute a kk-server solution of nn requests from a unit interval, with total cost nO(1/logk)n^{O(1/\log k)}, in contrast to the worst-case Θ(n/k)\Theta(n/k) bound; and a traveling salesman tour of nn points from a unit box, of length O(logn)O(\log{n}), in contrast to the worst-case Θ(n)\Theta(\sqrt{n}) bound; similar results hold for the euclidean minimum spanning tree, Steiner tree, and nearest-neighbor graphs. We show both results to be tight. Our techniques build on the Marcus-Tardos proof of the Stanley-Wilf conjecture, and on the recently emerging concept of twin-width; we believe our techniques to be more generally applicable

    Fast approximation of search trees on trees with centroid trees

    Full text link
    Search trees on trees (STTs) generalize the fundamental binary search tree (BST) data structure: in STTs the underlying search space is an arbitrary tree, whereas in BSTs it is a path. An optimal BST of size nn can be computed for a given distribution of queries in O(n2)O(n^2) time [Knuth 1971] and centroid BSTs provide a nearly-optimal alternative, computable in O(n)O(n) time [Mehlhorn 1977]. By contrast, optimal STTs are not known to be computable in polynomial time, and the fastest constant-approximation algorithm runs in O(n3)O(n^3) time [Berendsohn, Kozma 2022]. Centroid trees can be defined for STTs analogously to BSTs, and they have been used in a wide range of algorithmic applications. In the unweighted case (i.e., for a uniform distribution of queries), a centroid tree can be computed in O(n)O(n) time [Brodal et al. 2001; Della Giustina et al. 2019]. These algorithms, however, do not readily extend to the weighted case. Moreover, no approximation guarantees were previously known for centroid trees in either the unweighted or weighted cases. In this paper we revisit centroid trees in a general, weighted setting, and we settle both the algorithmic complexity of constructing them, and the quality of their approximation. For constructing a weighted centroid tree, we give an output-sensitive O(nlogh)O(nlogn)O(n\log h)\subseteq O(n\log n) time algorithm, where hh is the height of the resulting centroid tree. If the weights are of polynomial complexity, the running time is O(nloglogn)O(n\log\log n). We show these bounds to be optimal, in a general decision tree model of computation. For approximation, we prove that the cost of a centroid tree is at most twice the optimum, and this guarantee is best possible, both in the weighted and unweighted cases. We also give tight, fine-grained bounds on the approximation-ratio for bounded-degree trees and on the approximation-ratio of more general α\alpha-centroid trees

    The Diameter of Caterpillar Associahedra

    Get PDF
    The caterpillar associahedron A(G)\mathcal{A}(G) is a polytope arising from the rotation graph of search trees on a caterpillar tree GG, generalizing the rotation graph of binary search trees (BSTs) and thus the conventional associahedron. We show that the diameter of A(G)\mathcal{A}(G) is Θ(n+m(H+1))\Theta(n + m \cdot (H+1)), where nn is the number of vertices, mm is the number of leaves, and HH is the entropy of the leaf distribution of GG. Our proofs reveal a strong connection between caterpillar associahedra and searching in BSTs. We prove the lower bound using Wilber's first lower bound for dynamic BSTs, and the upper bound by reducing the problem to searching in static BSTs

    The Diameter of Caterpillar Associahedra

    Get PDF

    Fixed-Point Cycles and Approximate EFX Allocations

    Get PDF
    corecore